export const preventSpecialCharacters=(rule:any, value:string, callback:any)=> {
	if (value) {
		  let pattern = /[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/;
		if (pattern.test(value)) {
			callback(new Error('输入包含特殊符号'));
		} else {
			callback();
		}
	} else {
		callback();
	}
}
export const preventScript=(rule:any, value:string, callback:any)=> {
	if (value) {
		 let pattern = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi;;
		if (pattern.test(value)) {
			callback(new Error('输入包含特殊符号'));
		} else {
			callback();
		}
	} else {
		callback();
	}
}
export const preventUrl=(rule:any, value:string, callback:any)=> {
	if (value) {
		 let pattern = /^https?:\/\/([\w-]+\.)+[\w-]+(\/[\w-.\/?%&=]*)?$/;
		if (!pattern.test(value)) {
			callback(new Error('网址不合法'));
		} else {
			callback();
		}
	} else {
		callback();
	}
}